//
//  MainViewController.m
//  FreeTravel
//
//  Created by 徐康 on 16/8/26.
//  Copyright © 2016年 KX. All rights reserved.
//

#import "MainViewController.h"
#import "TravelShopViewController.h"
#import "CommendViewController.h"
#import "CommunityViewController.h"
#import "MineViewController.h"
#import "DestinationViewController.h"
#import "FreeTravelMacro.h"
@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.tabBar.barTintColor = COLORFORFREETRAVEL;
    //创建一系列的ViewController
    TravelShopViewController *travelShopViewController = [[TravelShopViewController alloc]init];
    CommendViewController *commendViewController = [[CommendViewController alloc]init];
    CommunityViewController *communityViewController = [[CommunityViewController alloc]init];
    MineViewController *mineViewController = [[MineViewController alloc]init];
    DestinationViewController *destinationViewController = [[DestinationViewController alloc]init];
    
    UINavigationController *naviVCOfTravelShop = [[UINavigationController alloc]initWithRootViewController:travelShopViewController];
    UINavigationController *naviVCOfCommend = [[UINavigationController alloc]initWithRootViewController:commendViewController];
    UINavigationController *naviVCOfCommunity = [[UINavigationController alloc]initWithRootViewController:communityViewController];
    UINavigationController *naviVCOfMine = [[UINavigationController alloc]initWithRootViewController:mineViewController];
    UINavigationController *naviVCOfDestination = [[UINavigationController alloc]initWithRootViewController:destinationViewController];
    
    self.viewControllers = @[naviVCOfCommend,naviVCOfDestination,naviVCOfTravelShop,naviVCOfCommunity,naviVCOfMine];
    
    
    commendViewController.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"推荐" image:[[UIImage imageNamed:@"tuijian2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] tag:1];
    destinationViewController.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"目的地" image:[[UIImage imageNamed:@"mudidi2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] tag:1];
    travelShopViewController.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"旅行商城" image:[[UIImage imageNamed:@"shangcheng2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] tag:1];
    communityViewController.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"社区" image:[[UIImage imageNamed:@"shequ2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] tag:1];
    mineViewController.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"我的" image:[[UIImage imageNamed:@"wode2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] tag:1];
    
    
    
    
   
    [commendViewController.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];

    [destinationViewController.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
    [travelShopViewController.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
    [communityViewController.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
    [mineViewController.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
